<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title><?php echo (C("app_name")); echo (C("app_copy")); ?></title>
    <link rel="shortcut icon" href="/schools1/CourseSEL/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/schools1/CourseSEL/Public/layui/css/layui.css" media="all">
    <link rel="stylesheet" type="text/css" href="/schools1/CourseSEL/Public/css/font-awesome.min.css">
    <link rel="stylesheet" href="/schools1/CourseSEL/Public/build/css/app.css" media="all">
     <script src="/schools1/CourseSEL/Public/layui/layui.js"></script>
    <script src="/schools1/CourseSEL/Public/js/jquery-1.11.1.min.js"></script>
    <style>
        .layui-footer2{position:fixed;left:0px;right:0;bottom:0;height:44px;line-height:44px;padding:0 15px;background-color:#eee}
    </style>
</head>
<body>
    <div class="layui-layout layui-layout-admin kit-layout-admin">
        <div class="layui-header">
            <div class="layui-logo" style="font-size: 30px;"><b><?php echo (C("app_name")); ?></b></div>
            <div class="layui-logo kit-logo-mobile"><?php echo (C("app_name")); ?></div>
            <ul class="layui-nav layui-layout-left kit-nav" kit-navbar>
                <li class="layui-nav-item"><a href="javascript:;" style="font-size: 20px;"><?php echo (C("site_name")); ?></a></li>
                <!-- <li class="layui-nav-item"><a href="javascript:;" class="layui-btn layui-btn-radius layui-btn-small">后台</a></li> -->
                <!-- <li class="layui-nav-item"><a href="javascript:;" id="pay"><i class="fa fa-gratipay" aria-hidden="true"></i> 撩我</a></li> -->
                <!-- <li class="layui-nav-item">
                    <a href="javascript:;">其它系统</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;" data-url="<?php echo U('test');?>" data-icon="fa-bar-chart" data-title="数据分析" kit-target data-id='11'>邮件管理</a></dd>
                        <dd><a href="javascript:;">消息管理</a></dd>
                        <dd><a href="javascript:;">授权管理</a></dd>
                    </dl>
                </li> -->
            </ul>
            <ul class="layui-nav layui-layout-right kit-nav" lay-filter="kitNavbar" kit-navbar>
                <li class="layui-nav-item">
                    <a href="javascript:;">
                        <!-- <img src="http://m.zhengjinfan.cn/images/0.jpg" class="layui-nav-img"> --> <i class="fa fa-user-circle-o " style="font-size: 20px; margin: 5px;" aria-hidden="true"></i><?php echo (session('username')); ?>&nbsp;
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a href="<?php echo U('mysel');?>" data-url="" data-icon="fa-bar-chart" data-title="数据分析" kit-target data-id='12'>选课记录</a></dd>
                        <dd><a href="<?php echo U('pass');?>">修改密码</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item" ><a href="<?php echo U('Index/Login/out_login');?>" onclick="return out_login();"><i class="fa fa-sign-out" aria-hidden="true"></i> 注销</a></li>
            </ul>
        </div>
        
        <div class="layui-container" style="margin-top: 20px;">
            <div class="layui-row">
                <div class="layui-col-md12">
                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                  <legend><?php echo ($sel["title"]); ?></legend>
                </fieldset>
                    <form class="layui-form" action="/schools1/CourseSEL/index.php/Index/Index/do_sel/seid/<?php echo ($sel["seid"]); ?>" method="post">
                    <blockquote class="layui-elem-quote"><?php echo ($sel["description"]); ?></blockquote>
                     
                    
                    <div class="layui-form-item">
                      <label class="layui-form-label">课程选择</label>
                        <div class="layui-input-block">
                           <input type="checkbox" name="selection[]" title="物理" id="selection" value="物" <?php check_checkbox('物',$stusel);?>>
                           <input type="checkbox" name="selection[]" title="化学" id="selection" value="化" <?php check_checkbox('化',$stusel);?>>
                           <input type="checkbox" name="selection[]" title="生物" id="selection" value="生" <?php check_checkbox('生',$stusel);?>>
                           <input type="checkbox" name="selection[]" title="政治" id="selection" value="政" <?php check_checkbox('政',$stusel);?>>
                           <input type="checkbox" name="selection[]" title="历史" id="selection" value="史" <?php check_checkbox('史',$stusel);?>>
                           <input type="checkbox" name="selection[]" title="地理" id="selection" value="地" <?php check_checkbox('地',$stusel);?>>
                           
                        </div>
                    </div>
                    <!-- <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">选课说明</label>
                        <div class="layui-input-block">
                          <textarea class="layui-textarea layui-hide" name="description" lay-verify="content" id="LAY_demo_editor"><?php echo ($sel["description"]); ?>
                          </textarea>
                        </div>
                    </div> -->
                    <hr class="layui-bg-green">
                    <div class="layui-form-item">
                      <div class="layui-input-block">
                      <!-- <a class="layui-btn" href="javascript:;" lay-submit onclick="sub('<?php echo ($te["tid"]); ?>')">立即提交</a> -->
                      <!-- <button class="layui-btn" lay-submit onsubmit="sub('<?php echo ($te["tid"]); ?>')">立即提交</button> -->
                      <?php if(empty($stusel)): ?><button class="layui-btn" lay-submit onclick="return check_sel(<?php echo ($sel["seid"]); ?>,'提交');">立即提交</button>
                        <?php else: ?>
                         <button class="layui-btn layui-btn-danger" lay-submit  onclick="return check_sel(<?php echo ($sel["seid"]); ?>,'修改');">确认修改</button><?php endif; ?>
                        <!-- <button class="layui-btn" lay-submit onclick="return check_sel(<?php echo ($sel["seid"]); ?>);">立即提交</button> -->
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                      <div style="height:54px;">&nbsp;</div>
                      </div>
                    </div>
                  </form>
                </div>
            </div>
           
            <div class="layui-footer2">
    <!-- 底部固定区域 -->
    &copy; 2021 |&nbsp;<img src="/schools1/CourseSEL/16.png" alt=""> 夏令营报名 | Design by <a href="javascript:;" id="me"> ly</a> | <a href="javascript:;" id="pay"><i class="fa fa-gratipay" aria-hidden="true"></i> 撩我</a>

 </div>
        </div>
       
    </div>
    
    <script type="text/javascript">
        // var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
        // document.write(unescape("%3Cspan id='cnzz_stat_icon_1264021086'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s22.cnzz.com/z_stat.php%3Fid%3D1264021086%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));
    </script>
    
    <script>
layui.use(['layer','element','form'], function(){
  var layer = layui.layer,element=layui.element,layedit = layui.layedit,form=layui.form;
});
$('#pay').on('click', function() {
    layer.open({
        title: false,
        type: 1,
        content: '<img src="/schools1/CourseSEL/Public/img/me.jpg" />',
        area: ['430px', '430px'],
        shadeClose: true
    });
 });
$('#me').on('click', function() {
    layer.open({
        title: '朋友，你好！',
        btn:'朕已知道',
        type: 0,
        scrollbar: false,
        content: '<div style="width:300px; height:105px; background-color:#393D49;color: #fff; margin:-20px;"><div style="padding:20px;text-align:center;">Email:hxb0810@163.com<br>Tel:15534378771</div></div>',
        area: ['300px', '200px'],
        shadeClose: true
    });
 });
    function out_login(){
        if(confirm("确定要退出么？")){
        return true;
        }else{
        return false;
        }
    };
    function check_sel(x,action){
      var index1 = layer.load();
        var chk_value=[];
        $('input[id="selection"]:checked').each(function(){
            chk_value.push($(this).val());
        });
        var seid=x,year='<?php echo ($sel["year"]); ?>',action=action;
        //发异步验证
        //alert(action);
          $.get("<?php echo U('check_sel');?>",{seldata:chk_value,seid:seid},function(data,status){
                //alert("Data: " + data + "\nStatus: " + status);
                if (status=='success') {
                    layer.close(index1);
                      if (data == 3) {
                      
                        layer.confirm('确认提交本次选课结果么？', {
                        title:'提示：',
                        skin: 'layui-layer-molv',
                        btn: ['确定','取消'] //按钮
                      }, function(index){
                          $.post("<?php echo U('do_sel');?>",{seldata:chk_value,seid:seid,action:action,year:year},function(data,status){
                              if (data>=1) {
                                   layer.msg('选课成功！', {icon: 1});
                                   setTimeout("history.go(-1)",2000) ; 
                              } else {
                                   layer.msg('数据库错误，请联系管理员！',{icon: 5,time:3000});
                              }
                              //alert("Data: " + data + "\nStatus: " + status); 
                          });
                      });
                      //location.href="/schools1/CourseSEL/index.php/Index/Index/selection/seid/"+seid;
                  } else{
                      if (data == 1) {
                          layer.msg('本次选课为6选3,您所选的科目不是三科！',{icon: 5,time:3000});
                      }
                      if (data==0) {
                          layer.msg('该选课组合尚未开放！请重新选择！',{icon: 5,time:3000});
                      }
                      if (data==2) {
                          layer.msg('尚未修改，请修改！',{icon: 5,time:3000});
                      }
                           
                      
                  } 
                } else {
                    layer.msg('程序错误！');
                }
                
          });
          return false;
    }
    </script>

</body>

</html>